//
//  Mine_Know_TableViewCell.m
//  Cook Street
//
//  Created by dllo on 15/8/18.
//  Copyright (c) 2015年 LANOU. All rights reserved.
//

#import "Mine_Know_TableViewCell.h"

@implementation Mine_Know_TableViewCell




-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.img = [[UIImageView alloc]initWithFrame:CGRectMake(20, 20, (WIDTH - 40) , (WIDTH - 40) / 2)];
        self.img.layer.masksToBounds = YES;
        self.img.layer.cornerRadius = 10;
        [self.contentView addSubview:self.img];
        
        
        
        
        self.grayView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH - 40, (WIDTH - 40) / 8 + 20)];
        self.grayView.backgroundColor = [UIColor blackColor];
        self.grayView.alpha = 0.2;
        [self.img addSubview:self.grayView];
        
        
        self.label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, WIDTH - 40, (WIDTH - 40) / 8)];
        self.label.font = [UIFont  boldSystemFontOfSize:15.0f];
        self.label.textColor = [UIColor whiteColor];
        [self.img addSubview:self.label];
        
        
        
        self.contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, (WIDTH - 40) / 13, WIDTH - 40, (WIDTH - 40) / 8)];
        self.contentLabel.font = [UIFont  boldSystemFontOfSize:13.0f];
        self.contentLabel.textColor = [UIColor whiteColor];
        self.contentLabel.numberOfLines = 2;
        [self.img addSubview:self.contentLabel];
        
    }
    return self;
}

-(void)getValue:(KnowledgeModel *)value
{

    [self.img sd_setImageWithURL:[NSURL URLWithString:value.img] placeholderImage:[UIImage imageNamed:@"default"]];
    self.label.text = value.title;
    self.contentLabel.text = [NSString stringWithFormat:@"%@...",[value.content substringToIndex:20]];

    
}





/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
